﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MapWindow;
using SkiPathStandalone;
using MapWindow.Data;

namespace TestStandalone
{
    public partial class Form1 : Form
    {
        public static String DEMFilename;
        public static String ShapeFilename;
        public Raster DEMGrid = new Raster();
        public FeatureSet Shapefile = new FeatureSet();

        public Form1()
        {
            InitializeComponent();
        }

        private void loadDEMToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult result = openFileDialog1.ShowDialog(); // DEM.
            if (result == DialogResult.OK) // Test result.
            {
                DEMFilename = openFileDialog1.FileName;
            }
            try
            {
                DEMGrid.Open(DEMFilename);
                map1.Layers.Add(DEMGrid);
            }
            catch { }
        }

        private void loadShapefileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog2.Filter = "Shapefile(*.shp)|*.shp"; 
            DialogResult result = openFileDialog2.ShowDialog(); // Shape.
            
            if (result == DialogResult.OK) // Test result.
            {
                ShapeFilename = openFileDialog2.FileName;
            }
            try
            {
                Shapefile.Open(ShapeFilename);
                map1.Layers.Add(Shapefile);
            }
            catch { }
        }

        private void commitFunctionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //call functionStandAlone
            SkiPathStandalone.ProfileCreator aa = new ProfileCreator();
            //aa.GenerateProfile();
            aa.GenerateProfile(DEMGrid, Shapefile);
        }



    }
}
